Method for quick weighing of loose and small packages of traditional chinese medicine (tcm)

ABSTRACT

The present disclosure discloses a method for quick weighing of loose and small packages of traditional Chinese medicine (TCM), comprising: 1) establishing an equivalent physical model of a weighing system for loose and small packages, and, through Laplace transformation and Z transformation, obtaining a formula of the mass M of medicine packages to be weighed; 2) calculating a 1 , a 2 , b 1 , and b 2  on the basis of a vector prediction error; 3) according to a 1 , a 2 , b 1 , and b 2  obtained and the formula of the mass of medicine packages to be weighed, obtaining the mass of the loose and small packages of TCM that are weighed. According to the method, the scalar prediction error is expanded into the vector prediction error based on the traditional method so as to construct a new identification model based on the vector prediction error, and as a result the utilization efficiency of prediction error turns higher.

TECHNICAL FIELD

The present disclosure relates to the technical field of automaticmedicine cabinets, and in particular to a method for weighingtraditional Chinese medicines in loose and small packages.

BACKGROUND

Traditional Chinese medicine (hereinafter referred to as TCM), which hasa long history in China, is one of the three quintessences in Chineseculture. As a valuable asset of Chinese medicine, TCM has always enjoyedgreat popularity among patients. With the development of the age and thecontinuous progress of science and technology, traditional TCM decoctionpieces have been transformed into new modem TCM ones, and small packagesof TCM decoction pieces have emerged thereby. Small packages of TCM hasmany advantages, such as unchanged medicine character, accurate dosage,facilitating review, cleanness and hygiene, convenient dispensing, andimproving efficiency, which have been widely used in medicalinstitutions in recent decades and received very positive responses,seeing an extremely promising development prospect.

In the prior art, in order to improve the efficiency of TCM prescriptionfilling and dispensing, many kinds of automatic TCM cabinets andautomatic prescription filling devices have emerged. For example, anautomatic medicine dispensing device with full-coverage chuck array andthe control method thereof is provided in the previous application No.201910614948.9 claimed by the applicant, wherein a full-coverage vacuumsuction robot is disclosed, and this method uses this robot to graspmedicine packages and weighs the small packages of TCM by using anelectronic weighing device and by controlling a vacuum-chuck aircircuit, so as to obtain a specified number of medicine packages.

In the prior art, when vacuum chucks are used to grasp small packages ofTCM, it cannot guarantee that each vacuum chuck can successfully graspthe medicine package, so when the vacuum chuck is controlled to releasethe medicine package, a problem may come out that a number of medicinepackages dropped on the electronic weighing device may be inconsistentwith the required number of medicine packages, thus affecting the timefor prescription filling.

In addition, the electronic weighing device in the prior art will gothrough an unstable oscillation period if any medicine packages fall onit, during which there would be a large weighing error. In order toprevent the weighing accuracy from being affected by an electronicscale's oscillation caused by dropping medicine packages, usually, thepractice in the prior art is to sample and calculate after theelectronic scale resumes stability. However, waiting for the electronicscale to stabilize is time consuming and reduces the efficiency ofprescription filling.

In order to solve the problem that the electronic scale has to waituntil stabilized for weighing in the traditional weighing method, adynamic weighing method is disclosed in a method for dynamic weighing ofTCM in loose small packages with the patent No. 202010706273.3. Based onthe traditional least square identification model, this method adopts arecursive algorithm which can reduce computing resources and overheadsto a certain degree, thus reducing the weighing time and improving theweighing efficiency. However, it still works with current-time scalarprediction errors of the traditional identification model, which has adefect of low data utilization, so that the coefficient identificationefficiency of this weighing model needs further improvement.

In addition, in the traditional identification model, a current-timescalar prediction error is used for recursive iteration every time andfails to effectively use an overall data change trend within the localneighborhood and the vector prediction error information, thus resultingin problems such as slow convergence of weighing model coefficients andlarge fluctuation of steady-state errors.

SUMMARY

For this purpose, the present disclosure aims at providing a method forquick weighing of loose and small packages of traditional Chinesemedicine (TCM) in order to solve technical problems, i.e., to furtherimprove the weighing accuracy and reduce the weighing time of loose andsmall packages of TCM.

According to the present disclosure, the method for quick weighing ofloose and small packages of TCM includes:

-   -   1) Establishing an equivalent physical model of a weighing        system for loose and small packages:

$\begin{matrix}{{{\left( {M + m} \right)\frac{d{y(t)}^{2}}{d^{2}t}} + {c\frac{d{y(t)}}{dt}} + {k{y(t)}}} = {{Mgu}(t)}} & (1)\end{matrix}$

Wherein, m is the equivalent mass of the medicine receiving tank; M isthe mass of medicine packages to be weighed; y(t) is the output signalof the weighing system; g is the gravitational acceleration; c is theequivalent damping coefficient of the weighing system; k is theequivalent elastic coefficient of the weighing system; when loose andsmall packages of TCM fall on the medicine receiving tank, the medicinepackages will vibrate synchronously with the weighing system representedby the medicine receiving tank, which may be regarded as applying a stepsignal Mgu(t) to the weighing system, wherein u(t) represents the stepsignal; after Laplace transformation, the output signal is obtained asfollows:

$\begin{matrix}{{Y(s)} = {{Mg} \cdot \frac{1}{s} \cdot \frac{1}{{\left( {M + m} \right)s^{2}} + {cs} + k}}} & (2)\end{matrix}$

Since the sampled signal is a discrete value, Z transformation isperformed for Y(s) so as to obtain:

$\begin{matrix}{{Y(z)} = {\frac{{b_{1}z^{- 1}} + {b_{2}z^{- 2}}}{1 + {a_{1}z^{- 1}} + {a_{2}z^{- 2}}} \cdot {U(z)}}} & (3)\end{matrix}$

Wherein a₁, a₂, b₁, and b₂ are coefficients related to M, m, c, and k;and taking into account a weighing error caused by noise at an inputterminal, the formula (3) is expressed by a difference equation as:

y(t)=−a ₁ y(t−1)−a ₂ y(t−2)+b ₁ u(t−1)+b ₂ u(t−2)+e(t)  (4)

In view of the formula (3) and according to the final-value theorem ofthe Z transformation, a system output in a steady state is obtained asfollows:

$\begin{matrix}{{\lim\limits_{t\rightarrow\infty}{y(t)}} = {{\lim\limits_{z\rightarrow 1}{\left( {z - 1} \right) \cdot {Y(z)}}} = {\frac{b_{1} + b_{2}}{1 + a_{1} + a_{2}} = \frac{Mg}{k}}}} & (5)\end{matrix}$

As a result, a calculation formula is obtained for the mass of medicinepackages to be weighed M as follows:

$\begin{matrix}{M = {\frac{k}{g} \cdot \frac{b_{1} + b_{2}}{1 + a_{1} + a_{2}}}} & (6)\end{matrix}$

Wherein g is the gravitational acceleration, and k is the equivalentelastic coefficient of the weighing system;

-   -   2) Calculating a₁, a₂, b₁, and b₂ on the basis of a vector        prediction error, including:    -   a) A scalar prediction error at the time t of a sample sequence        of the weighing system is defined as:

e(t)=y(t)−[−â ₁ y(t−1)−â ₂ y(t−2)+{circumflex over (b)} ₁u(t−1)+{circumflex over (b)} ₂ u(t−2)]=y(t)−φ^(T) _(t){circumflex over(θ)}_(t−1)  (7)

In the formula t>2, wherein:

φ_(t)=[−y(t−1),−y(t−2),u(t−1),u(t−2)]^(T)  (8)

{circumflex over (θ)}_(t−1)=[â ₁ ,â ₂ ,{circumflex over (b)} ₁,{circumflex over (b)} ₂]^(T)  (9)

φ_(t) represents an information vector of the system at a time of thet^(th) sample point, {circumflex over (θ)}_(t−1) represents acoefficient identification result of the system at a time before thet^(th) sample point; y(t) represents a sample output sequence at thet^(th) sample point, y(t−1) represents a sample output sequence at atime before the t^(th) sample point, y(t−2) represents a sample outputsequence at two times before the t^(th) sample point; u(t−1) is a sampleoutput sequence at a time before the t^(h) sample point, u(t−2) is asample output sequence at two times before the t^(th) sample point; â₁,is an estimated value of the coefficient a₁, â₂ is an estimated value ofthe coefficient a₂, {circumflex over (b)}₁ is an estimated value of thecoefficient b₁, and {circumflex over (b)}₂ is an estimated value of thecoefficient b₂;

-   -   b) By taking into consideration p_(t) sets of data in total from        the time t−p_(t)+1 to the time t of the weighing system sample        sequence, it is set that:

$\begin{matrix}{Y_{t}^{p_{t}} = \begin{bmatrix}{y(t)} \\{y\left( {t - 1} \right)} \\M \\{y\left( {t - p_{t} + 1} \right)}\end{bmatrix}} & (10) \\{\Phi_{t}^{p_{t}} = \left\lbrack {\varphi_{t},\varphi_{t - 1},L,\varphi_{t - p_{t} + 1}} \right\rbrack} & (11)\end{matrix}$

Wherein: p_(t) is a length of time window; Y_(t) ^(p) ^(t) represents anoutput vector formed by inverting a sample output sequence within arange p_(t) of the system previous to a time t; Φ_(t) ^(p) ^(t)represents an information matrix formed by inverting an informationvector within a range p_(t) previous to a time t; p_(t) is a variablethat varies along with any change of statistical properties of locallysampled data at the time t, resulting in the vector prediction errorwith an extended length of time window of p_(t) as follows:

$\begin{matrix}{E_{t}^{p_{t}} = {\begin{bmatrix}{e(t)} \\{e\left( {t - 1} \right)} \\M \\{e\left( {t - p_{t} + 1} \right)}\end{bmatrix} = \begin{bmatrix}{{y(t)} - {\varphi_{t}^{T}{\overset{\hat{}}{\theta}}_{t - 1}}} \\{{y\left( {t - 1} \right)} - {\varphi_{t - 1}^{T}{\overset{\hat{}}{\theta}}_{t - 2}}} \\M \\{{y\left( {t - p_{t} + 1} \right)} - {\varphi_{t - p_{t} + 1}^{T}{\overset{\hat{}}{\theta}}_{t - p_{t}}}}\end{bmatrix}}} & (12)\end{matrix}$

E_(t) ^(p) ^(t) represents a vector formed by inverting a scalarprediction error sequence within a range p_(t) of the system previous toa time t; and, given that theoretically {circumflex over (θ)}_(t−1) iscloser to a real value θ than an estimated value of a system coefficientat a previous time, {circumflex over (θ)}_(t−1) is used to replace theestimated value of the system coefficient at the previous time, so thatthe above formula may be altered into:

$\begin{matrix}{E_{t}^{p_{t}} = {\begin{bmatrix}{{y(t)} - {\varphi_{t}^{T}{\overset{\hat{}}{\theta}}_{t - 1}}} \\{{y\left( {t - 1} \right)} - {\varphi_{t - 1}^{T}{\overset{\hat{}}{\theta}}_{t - 1}}} \\M \\{{y\left( {t - p_{t} + 1} \right)} - {\varphi_{t - p_{t} + 1}^{T}{\overset{\hat{}}{\theta}}_{t - 1}}}\end{bmatrix} = {Y_{t}^{p_{t}} - {{\Phi^{T}}_{t}^{p_{t}}{\overset{\hat{}}{\theta}}_{t - 1}}}}} & (13)\end{matrix}$

It can be known from the formula (13) that the weighing system is basedon an identification model of a vector prediction error:

Y _(t) ^(p) ^(t) =Φ_(t) ^(Tp) ^(t) {circumflex over (θ)}_(t−1) +E _(t)^(p) ^(t)   (14)

The formula (14) is expressed as the identification model of the vectorprediction error:

-   -   c) According to the identification model of the vector        prediction error, a criterion function is defines as below:

$\begin{matrix}{{J\left( {\overset{\hat{}}{\theta}}_{t - 1} \right)} = {{\sum\limits_{i = 1}^{t}{{Y_{i}^{p_{i}} - {\Phi^{T}{{}_{}^{Pi}\left. \theta \right.\hat{}_{i - 1}^{}}}}}^{2}} = {\sum\limits_{i = 1}^{t}{E_{i}^{p_{i}}}^{2}}}} & (15)\end{matrix}$

Wherein ∥E_(t) ^(p) ^(t) ∥ is a 2-norm of the vector E_(t) ^(p) ^(t) ,and J({circumflex over (θ)}_(t−1)) is a criterion function;

-   -   d) {circumflex over (θ)}_(t−1) that may minimize the criterion        function is evaluated to obtain a coefficient estimated value        based on the identification model of the vector prediction        error.

$\begin{matrix}{Z_{t} = \begin{bmatrix}Y_{1}^{p_{1}} \\Y_{2}^{p_{2}} \\M \\Y_{t}^{p_{t}}\end{bmatrix}} & (16) \\{H_{t} = \begin{bmatrix}{\Phi_{\;}^{T}}_{1}^{p_{1}} \\{\Phi_{\;}^{T}}_{2}^{p_{2}} \\M \\{\Phi_{\;}^{T}}_{t}^{p_{t}}\end{bmatrix}} & (17)\end{matrix}$

-   -   So that the criterion function may be expressed as:

J({circumflex over (θ)}_(t−1))=(Z _(t) −H _(t){circumflex over(θ)}_(t−1))^(T)(Z _(t) −H _(t){circumflex over (θ)}_(t−1))  (18)

A vector differential formula is used to derive J({circumflex over(θ)}_(t−1)) and set the result thereof as 0, so as to calculate{circumflex over (θ)}_(t−1) that may minimize the criterion function:

$\begin{matrix}{{\overset{\hat{}}{\theta}}_{t - 1} = {{\left( {H_{t}^{T}H_{t}} \right)^{- 1}H_{t}^{T}Z_{t}} = {\left\lbrack {\sum\limits_{i = 1}^{t}{\Phi{{}_{}^{Pi}{}_{}^{}}\,_{i}^{P_{i}}}} \right\rbrack^{- 1}\left\lbrack {\sum\limits_{i = 1}^{t}{\Phi{{}_{}^{Pi}{}_{}^{}}\,_{i}^{P_{i}}}} \right\rbrack}}} & (19)\end{matrix}$

-   -   d) The recursive calculation form of {circumflex over (θ)}_(t−1)        is derived, which sets that:

$\begin{matrix}{R_{t}^{- 1} = {\sum\limits_{i = 1}^{t}{\Phi_{i}^{p_{i}}\Phi_{i}^{{Tp}_{i}}}}} & (20)\end{matrix}$

So that:

R _(t) ⁻¹ =R _(t−1) ⁻¹+Φ_(t) ^(p) ^(t) Φ_(t) ^(Tp) ^(t)   (21)

After the simplification of the above formula by using the matrixinversion theorem, a recursive formula for identifying coefficientsbased on the identification model of vector prediction error is finallyobtained as follows:

$\left\{ \begin{matrix}{{\overset{\hat{}}{\theta}}_{t + 1} = {{\overset{\hat{}}{\theta}}_{t} + {L_{t + 1}E_{t + 1}^{p_{t}}}}} & {\mspace{283mu}(22)} \\{L_{t + 1} = {R_{t}{\Phi_{t + 1}^{p_{t}}\left\lbrack {I_{p_{t}} + {\Phi_{t + 1}^{{Tp}_{t}}R_{t}\Phi_{t + 1}^{p_{t}}}} \right\rbrack}^{- 1}}} & \left( {23} \right) \\{R_{t + 1} = {R_{t} - {L_{t + 1}\Phi_{t + 1}^{{Tp}_{t}}R_{t}}}} & (24)\end{matrix} \right.$

Wherein L_(t+1) is an algorithm gain vector; the coefficient estimationvector {circumflex over (θ)}_(t+1) at the time t+1 is the product of thegain vector L_(t+1) and the vector prediction error EP, which correctsthe coefficient estimation vector {circumflex over (θ)}_(t) at the timet;

Here is the recursion process:

-   -   (1) Initialization: a start time is set as t₀=5, which indicates        the recursion process starts from the fifth sampling point of        the sampling sequence, {circumflex over (θ)}₅=[0,0,0,0]^(T);        R₅=α·I₄, wherein α is a sufficiently large positive integer, I₄        represents an identity matrix of 4×4; and at the same time, a        number of times, N, of recursive iteration is determined;    -   (2) By analyzing the statistical characteristics of locally        sampled data, the length of time window p_(t) is determined; at        the same time, the sample output sequence and the input sequence        of the weighing system are obtained to construct an output        vector Y_(t+1) ^(p) ^(t) according to the formula (10), and to        construct an information matrix Φ_(t+1) ^(p) ^(t) according to        the formulas (8) (11); and then a vector prediction error        E_(t+1) ^(p) ^(t) is obtained by using the formula (13);    -   (3) L_(t+1) and R_(t+1) are calculated according to the        formula (23) and formula (24) in the recursion formula, and then        {circumflex over (θ)}_(t+1) is calculated according to the        formula (22);    -   (4) It is determined whether t=t+1 has reached a specified        number of iteration times N. If not, proceed to the step (2), or        otherwise end the recursion process;    -   3) According to a₁, a₂, b₁, and b₂ obtained in the step 2) and        the formula (6), obtaining the weight of the loose and small        packages of TCM that are weighed.

Further, the length of time window p_(t) is determined by the methodbelow:

A length interval of the time window of the t^(th) sample time isdefined as follows:

P _(t)∈[P _(min) ,P _(max)]  (25)

Wherein P_(min) represents the lower limit value of the length interval,and P_(max) represents the upper limit value of the length interval,i.e., the length of the time window p_(t) can slide from P_(min) toP_(max) according to statistical characteristics of the sampled data;

A standard deviation of a sequence formed by d system sample outputvalues previous to a time t is defined as follows:

$\begin{matrix}{S_{t} = \sqrt{\frac{\sum\limits_{i = {t - d + 1}}^{t}\left( {y_{i} - \overset{\_}{y}} \right)^{2}}{d}}} & (26)\end{matrix}$

Wherein, it can be seen from tests for d that the stability andsmoothness of local data can be better reflected when d=5; y_(i)represents a system sample output value at the i^(th) sample time, and yrepresents an average sample value of a sequence formed by d systemsample output values previous to the time t, which is calculated by thefollowing formula:

$\begin{matrix}{\overset{\_}{y} = {\frac{1}{d} \cdot {\overset{t}{\sum\limits_{i = {t - d + 1}}}y_{i}}}} & (27)\end{matrix}$

An initial recursive time of the recursive algorithm is set as t₀, and asample standard deviation of d pieces of data previous to the initialtime by the formula (26), which is set as S_(t0); and a self-adaptivefunction of the time window length is used to determine the time windowlength p_(t) at the sample time t as follows:

$\begin{matrix}{p_{t} = \left\lbrack {\left( {1 - \frac{S_{t}}{S_{t0}}} \right)P_{\max}} \right\rbrack} & (28)\end{matrix}$

Wherein,

$\left\lbrack {\left( {1 - \frac{S_{t}}{S_{t0}}} \right) \cdot P_{\max}} \right\rbrack$

represents a maximum integer not more than a real number

$\left( {1 - \frac{S_{t}}{S_{t0}}} \right) \cdot {P_{\max}.}$

Further, in the recursion process, α=10⁷, and the number of iterationtimes N is 8-10.

The present disclosure is beneficial in:

-   -   1. The traditional least square identification algorithm only        uses a scalar prediction error at the latest time to correct a        coefficient identification result at a time before in the course        of the identification of a₁, a₂, b₁, and b₂, thus leading to        quite low data utilization. According to the method for quick        weighing of loose and small packages of TCM in the present        disclosure, the scalar prediction error is expanded into the        vector prediction error based on the traditional method so as to        construct a new identification model based on the vector        prediction error, and as a result the utilization efficiency of        prediction error turns higher. It could be known through an        actual weighing comparison test that, compared with the        traditional weighing method, the weighing method provided by the        present disclosure has faster convergence, higher coefficient        identification accuracy, and reduces the weighing time and        improves the weighing efficiency.    -   2. As for the time window length p_(t) in the present        disclosure, as the value of p_(t) increases, the identification        accuracy of the identification method based on an identification        model of multi-vector prediction error will increase as well,        however, correspondingly, the identification speed will decrease        due to the increase of the time window width. As the value of        p_(t) decreases, the identification accuracy decreases as well,        but the identification speed increases. Therefore, p_(t) can be        set neither too large nor too small, so it is a technical        problem to take into consideration both identification accuracy        and identification speed.    -   According to the method for quick weighing of loose and small        packages of TCM, the time window length p_(t) is automatically        determined through the constructed self-adaptive function of the        time window length, thereby the technical problem of balancing        the identification accuracy and identification speed based on        the identification model of the multi-vector prediction error is        solved.    -   3. In the traditional identification model, a current-time        scalar prediction error is used for recursive iteration every        time and fails to effectively use an overall data change trend        within the local neighborhood and the vector prediction error        information, thus resulting in problems such as slow convergence        of weighing model coefficients and large fluctuation of        steady-state errors. However, the method for quick weighing of        loose and small packages of TCM provided in the present        disclosure constructs a new identification model based on the        vector prediction error and uses the vector prediction error in        the range of the time window length p_(t) to perform recursive        iteration, and makes full use of the overall change trend        information of data within the local neighborhood. In addition,        it is verified by experiment that compared with the        identification model which adopts current-time scalar prediction        error to perform recursive iteration each time the method of the        present disclosure provides faster convergence of weighing model        coefficients, and has an advantage of smaller fluctuation of        steady-state errors.    -   4. The method for quick weighing of loose and small packages of        TCM provided in the present disclosure is applied to not only        weighing of loose and small packages of TCM, but also to other        food or medicines in loose packages in need of quick weighing.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a graph of the AD sampling result of an electronic weighingsignal.

FIG. 2 shows the identification result by using the traditional leastsquare identification method.

FIG. 3 shows the identification result based on the identification modelof the vector prediction error.

DETAILED DESCRIPTION

The present disclosure will be further described with reference tofigures and embodiments below.

In this embodiment, a method for quick weighing of loose and smallpackages of TCM includes:

-   -   1) Establishing an equivalent physical model of a weighing        system for loose and small packages:

$\begin{matrix}{{{\left( {M + m} \right)\frac{d{y(t)}^{2}}{d^{2}t}} + {c\frac{d{y(t)}}{dt}} + {k{y(t)}}} = {Mg{u(t)}}} & (1)\end{matrix}$

Wherein, m is the equivalent mass of the medicine receiving tank; M isthe mass of medicine packages to be weighed; y(t) is the output signalof the weighing system; g is the gravitational acceleration; c is theequivalent damping coefficient of the weighing system; k is theequivalent elastic coefficient of the weighing system; when loose andsmall packages of TCM fall on the medicine receiving tank, the medicinepackages will vibrate synchronously with the weighing system representedby the medicine receiving tank, which may be regarded as applying a stepsignal Mgu(t) to the weighing system, wherein u(t) represents the stepsignal. After Laplace transformation, the formula (1) obtains the outputsignal as follows:

$\begin{matrix}{{Y(s)} = {{Mg} \cdot \frac{1}{s} \cdot \frac{1}{{\left( {M + m} \right)s^{2}} + {cs} + k}}} & (2)\end{matrix}$

Since the sampled signal is a discrete value, Z transformation isperformed for Y(s) so as to obtain:

$\begin{matrix}{{Y(z)} = {\frac{{b_{1}z^{- 1}} + {b_{2}z^{- 2}}}{1 + {a_{1}z^{- 1}} + {a_{2}z^{- 2}}} \cdot {U(z)}}} & (3)\end{matrix}$

Wherein a₁, a₂, b₁, and b₂ are coefficients related to M, m, c and k.Taking into account a weighing error caused by noise at an inputterminal, the formula (3) is expressed by a difference equation as:

y(t)=−a ₁ y(t−1)−a ₂ y(t−2)+b ₁ u(t−1)+b ₂ u(t−2)+e(t)  (4)

In view of the formula (3) and according to the final-value theorem ofthe Z transformation, a system output in a steady state is obtained asfollows:

$\begin{matrix}{{\lim\limits_{t\rightarrow\infty}{y(t)}} = {{\lim\limits_{z\rightarrow 1}{\left( {z - 1} \right) \cdot {Y(z)}}} = {\frac{b_{1} + b_{2}}{1 + a_{1} + a_{2}} = \frac{Mg}{k}}}} & (5)\end{matrix}$

As a result, a calculation formula is obtained for the mass of medicinepackages to be weighed M as follows:

$\begin{matrix}{M = {\frac{k}{g} \cdot \frac{b_{1} + b_{2}}{1 + a_{1} + a_{2}}}} & (6)\end{matrix}$

Wherein g is the gravitational acceleration, and k is the equivalentelastic coefficient of the weighing system. k, as a constant related tothe weighing system, may be determined by experiment.

It can be known from the formula (6) that the key point of calculatingthe mass M of medicine packages to be weighed is identification of theweighing system coefficients a₁, a₂, b₁, and b₂.

-   -   2) Calculating a₁, a₂, b₁, and b₂ on the basis of a vector        prediction error, comprising:    -   a) A scalar prediction error at the time t of a sample sequence        of the weighing system is defined as:

e(t)=y(t)−[−â ₁ y(t−1)−â ₂ y(t−2)+{circumflex over (b)} ₁u(t−1)+{circumflex over (b)} ₂ u(t−2)]=y(t)−φ^(T) _(t){circumflex over(θ)}_(t−1)  (7)

In the formula t>2, wherein:

φ_(t)=[−y(t−1),−y(t−2),u(t−1),u(t−2)]^(T)  (8)

{circumflex over (θ)}_(t−1)=[â ₁ ,â ₂ ,{circumflex over (b)} ₁,{circumflex over (b)} ₂]^(T)  (9)

φ_(t) represents an information vector of the system at a time of thet^(th) sample point, {circumflex over (θ)}_(t−1) represents acoefficient identification result of the system at a time before thet^(th) sample point; y(t) represents a sample output sequence at thet^(th) sample point, y(t−1) represents a sample output sequence at atime before the t^(th) sample point, y(t−2) represents a sample outputsequence at two times before the t^(th) sample point; u(t−1) is a sampleoutput sequence at a time before the t^(h) sample point, u(t−2) is asample output sequence at two times before the t^(th) sample point; â₁is an estimated value of the coefficient a₁, â₂ is an estimated value ofthe coefficient a₂, {circumflex over (b)}₁ is an estimated value of thecoefficient b₁, and {circumflex over (b)}₂ is an estimated value of thecoefficient b₂.

-   -   b) By taking into consideration p_(t) sets of data in total from        the time t−p_(t)+1 to the time t of the weighing system sample        sequence, it is set that:

$\begin{matrix}{Y_{t}^{p_{t}} = \begin{bmatrix}{y(t)} \\{y\left( {t - 1} \right)} \\M \\{y\left( {t - p_{t} + 1} \right)}\end{bmatrix}} & (10) \\{\Phi_{t}^{p_{t}} = \left\lbrack {\varphi_{t},\varphi_{t - 1},L,\varphi_{t - p_{t} + 1}} \right\rbrack} & \left( {11} \right)\end{matrix}$

Wherein: p_(t) is a length of time window; Y_(t) ^(p) ^(t) represents anoutput vector formed by inverting a sample output sequence within arange p_(t) of the system previous to a time t; Φ_(t) ^(p) ^(t)represents an information matrix formed by inverting an informationvector within a range p_(t) previous to a time t; p_(t) is a variablethat varies along with any change of statistical properties of locallysampled data at the time t, resulting in the vector prediction errorwith an extended length of time window of p_(t) as follows:

$\begin{matrix}{E_{t}^{p_{t}} = {\begin{bmatrix}{e(t)} \\{e\left( {t - 1} \right)} \\M \\{e\left( {t - p_{t} + 1} \right)}\end{bmatrix} = \begin{bmatrix}{{y(t)} - {\varphi_{t}^{T}{\hat{\theta}}_{t - 1}}} \\{{y\left( {t - 1} \right)} - {\varphi_{t - 1}^{T}{\hat{\theta}}_{t - 2}}} \\M \\{{y\left( {t - p_{t} + 1} \right)} - {\varphi_{t - p_{t} + 1}^{T}{\hat{\theta}}_{t - p_{t}}}}\end{bmatrix}}} & (12)\end{matrix}$

E_(t) ^(p) ^(t) represents a vector formed by inverting a scalarprediction error sequence within a range p_(t) of the system previous toa time t; and, given that theoretically {circumflex over (θ)}_(t−1) iscloser to a real value θ than an estimated value of a system coefficientat a previous time, {circumflex over (θ)}_(t−1) is used to replace theestimated value of the system coefficient at the previous time, so thatthe above formula may be altered into:

$\begin{matrix}{E_{t}^{p_{t}} = {\begin{bmatrix}{{y(t)} - {\varphi_{t}^{T}{\hat{\theta}}_{t - 1}}} \\{{y\left( {t - 1} \right)} - {\varphi_{t - 1}^{T}{\hat{\theta}}_{t - 1}}} \\M \\{{y\left( {t - p_{t} + 1} \right)} - {\varphi_{t - p_{t} + 1}^{T}{\hat{\theta}}_{t - 1}}}\end{bmatrix} = {Y_{t}^{p_{t}} - {\Phi_{t}^{{Tp}_{t}}{\hat{\theta}}_{t - 1}}}}} & (13)\end{matrix}$

It can be known from the formula (13) that the weighing system is basedon an identification model of a vector prediction error:

Y _(t) ^(p) ^(t) =Φ_(t) ^(Tp) ^(t) {circumflex over (θ)}_(t−1) +E _(t)^(p) ^(t)   (14)

The formula (14) is expressed as the identification model of the vectorprediction error.

-   -   c) According to the identification model of the vector        prediction error, a criterion function is defines as below:

$\begin{matrix}{{J\left( {\overset{\hat{}}{\theta}}_{t - 1} \right)} = {{\sum\limits_{i = 1}^{t}{{Y_{i}^{p_{i}} - {\Phi^{T}{{}_{}^{Pi}\left. \theta \right.\hat{}_{i - 1}^{}}}}}^{2}} = {\sum\limits_{i = 1}^{t}{E_{i}^{p_{i}}}^{2}}}} & (15)\end{matrix}$

Wherein ∥E_(t) ^(p) ^(t) ∥ is a 2-norm of the vector E_(t) ^(p) ^(t) ,and J({circumflex over (θ)}_(t−1)) is a criterion function.

-   -   d) {circumflex over (θ)}_(t−1) that may minimize the criterion        function is evaluated to obtain a coefficient estimated value        based on the identification model of the vector prediction        error.

$\begin{matrix}{Z_{t} = \begin{bmatrix}Y_{1}^{p_{1}} \\Y_{2}^{p_{2}} \\M \\Y_{t}^{p_{t}}\end{bmatrix}} & (16) \\{H_{t} = \begin{bmatrix}{\Phi_{\;}^{T}}_{1}^{p_{1}} \\{\Phi_{\;}^{T}}_{2}^{p_{2}} \\M \\{\Phi_{\;}^{T}}_{t}^{p_{t}}\end{bmatrix}} & (17)\end{matrix}$

-   -   So that the criterion function may be expressed as:

J({circumflex over (θ)}_(t−1))=(Z _(t) −H _(t){circumflex over(θ)}_(t−1))^(T)(Z _(t) −H _(t){circumflex over (θ)}_(t−1))  (18)

A vector differential formula is used to derive J({circumflex over(θ)}_(t−1)) and set the result thereof as 0, so as to calculate{circumflex over (θ)}_(t−1) that may minimize the criterion function:

$\begin{matrix}{{\overset{\hat{}}{\theta}}_{t - 1} = {{\left( {H_{t}^{T}H_{t}} \right)^{- 1}H_{t}^{T}Z_{t}} = {{\left\lbrack {\sum\limits_{i = 1}^{t}{\Phi{{}_{}^{Pi}{}_{}^{}}\,_{i}^{P_{i}}}} \right\rbrack^{- 1}\left\lbrack {\sum\limits_{i = 1}^{t}{\Phi{{}_{}^{Pi}{}_{}^{}}\,_{i}^{P_{i}}}} \right\rbrack}.}}} & (19)\end{matrix}$

-   -   d) Although the formula of the coefficient {circumflex over        (θ)}_(t−1) to be identified is obtained, this formula needs to        use all the sample information of the weighing system starting        from the sample start time. The actual calculation process        consumes a large memory overhead, so that with the increase of        sample data, the inversion calculation of

$\left\lbrack {\sum\limits_{\;^{i = 1}}^{t}{\Phi_{i}^{p_{i}}{\Phi^{T}}_{i}^{p_{i}}}} \right\rbrack^{- 1}$

in the above formula will be great in amount, which decreases theidentification speed. To solve these problems, the recursive calculationform is further derived for {circumflex over (θ)}_(t−1). It is set that:

$\begin{matrix}{R_{t}^{- 1} = {\sum\limits_{i = 1}^{t}{\Phi{{}_{}^{Pi}{}_{}^{}}\,_{i}^{P_{i}}}}} & (20)\end{matrix}$

So that:

R _(t) ⁻¹ =R _(t−1) ⁻¹+Φ_(t) ^(p) ^(t) Φ_(t) ^(Tp) ^(t)   (21)

After the simplification of the above formula by using the matrixinversion theorem, a recursive formula for identifying coefficientsbased on the identification model of vector prediction error is finallyobtained as follows:

$\begin{matrix}{\quad\left\{ \begin{matrix}{{\overset{\hat{}}{\theta}}_{t + 1} = {{\overset{\hat{}}{\theta}}_{t} + {L_{t + 1}E_{t + 1}^{p_{t}}}}} & {\mspace{265mu}(22)} \\{L_{t + 1} = {R_{t}{\Phi_{t + 1}^{p_{t}}\left\lbrack {I_{p_{t}} + {{\Phi^{T}}_{t + 1}^{p_{t}}R_{t}\Phi_{t + 1}^{p_{t}}}} \right\rbrack}^{- 1}}} & {\mspace{265mu}(23)} \\{R_{t + 1} = {R_{t} - {L_{t + 1}{\Phi^{T}}_{t + 1}^{p_{t}}R_{t}}}} & {\mspace{76mu}{\quad\mspace{191mu}(24)}}\end{matrix} \right.} & \;\end{matrix}$

Wherein L_(t+1) is an algorithm gain vector; the coefficient estimationvector {circumflex over (θ)}_(t+1) at the time t+1 is the product of thegain vector L_(t+1) and the vector prediction error E_(t+1) ^(p) ^(t) ,which corrects the coefficient estimation vector {circumflex over(θ)}_(t) at the time t.

Here is the recursion process:

-   -   (1) Initialization: a start time is set as t₀=5, which indicates        the recursion process starts from the fifth sampling point of        the sampling sequence, {circumflex over (θ)}₅=[0,0,0,0]^(T);        R₅=α·I₄, wherein a is a sufficiently large positive integer        which is set as α=10⁷ in this embodiment, and I₄ represents an        identity matrix of 4×4; and at the same time, a number of times,        N, of recursive iteration is determined, which indicates the        number of times that the recursive identification algorithm,        based on the identification model of the vector prediction        error, has been cycled and completed since the starting of the        recursion process. According to results of many tests, when N=8:        10 times, the error rate of the coefficient identification        result {circumflex over (θ)} can be less than 2%; while N=10 in        this embodiment.    -   (2) By analysing the statistical characteristics of locally        sampled data, the length of time window p_(t) is determined; at        the same time, the sample output sequence and the input sequence        of the weighing system are obtained to construct an output        vector Y_(t+1) ^(p) ^(t) according to the formula (10), and to        construct an information matrix Φ_(t+1) ^(p) ^(t) according to        the formulas (8) (11); and then a vector prediction error        E_(t+1) ^(p) ^(t) is obtained by using the formula (13).    -   (3) L_(t+1) and R_(t+1) are calculated according to the        formula (23) and formula (24) in the recursion formula, and then        {circumflex over (θ)}_(t+1) is calculated according to the        formula (22).    -   (4) It is determined whether t=t+1 has reached a specified        number of iteration times N. If not, proceed to the step (2), or        otherwise end the recursion process.    -   3) According to a₁, a₂, b₁, and b₂ obtained in the step 2) and        the formula (6), obtaining the weight of the loose and small        packages of TCM that are weighed.

The only part of formulas (22) to (24) in the recursive formula thatneeds to be inverted is: [I_(p) _(t) +Φ_(t+1) ^(Tp) ^(t) R_(t)Φ_(t+1)^(p) ^(t) ]⁻¹, wherein I_(p) _(t) and I_(p) _(t) +Φ_(t+1) ^(Tp) ^(t)Φ_(t+1) ^(p) ^(t) are both matrices of p_(t)×p_(t), so the inversioncalculation only needs to invert the matrix of one p_(t)×p_(t). Whenp_(t) is small, the calculation is significantly reduced in amountcompared with the inversion calculation of

$R_{t} = {\left\lbrack {\sum\limits_{\;^{i = 1}}^{t}{\Phi_{i}^{p_{i}}{\Phi^{T}}_{i}^{p_{i}}}} \right\rbrack^{- 1}.}$

Compared with the traditional least square identification algorithm withan identification model y(t)=φ^(T) _(t){circumflex over (θ)}_(t−1)+e(t)and a recursive form {circumflex over (θ)}_(t+1)={circumflex over(θ)}_(t)+K_(t+1)e(t+1), every recursive process of the identificationalgorithm based on the identification model of vector prediction erroruses multiple times of sampled data within a time window range that hasa length of p_(t) and is previous to the time t, which enables higherdata utilization, and increases coefficient identification accuracy andweighing efficiency.

The length of time window p_(t) in this embodiment is determined by themethod below:

-   -   A length interval of the time window of the t^(th) sample time        is defined as follows:

p _(t)=[P _(min) ,P _(max)]  (25)

Wherein P_(min) represents the lower limit value of the length interval,and P_(max) represents the upper limit value of the length interval,i.e., the length of the time window p_(t) can slide from P_(min) toP_(max) according to statistical characteristics of the sampled data;

A standard deviation of a sequence formed by d system sample outputvalues previous to a time t is defined as follows:

$\begin{matrix}{S_{t} = \sqrt{\frac{\sum\limits_{i = {t - d + 1}}^{t}\left( {y - \overset{\_}{y}} \right)^{2}}{d}}} & (26)\end{matrix}$

Wherein, it can be seen from tests for d that the stability andsmoothness of local data can be better reflected when d=5; y_(i)represents a system sample output value at the i^(th) sample time, and yrepresents an average sample value of a sequence formed by d systemsample output values previous to the time t, which is calculated by thefollowing formula:

$\begin{matrix}{\overset{\_}{y} = {\frac{1}{d} \cdot {\sum\limits_{\;^{i = {t - d + 1}}}^{t}y_{i}}}} & (27)\end{matrix}$

An initial recursive time of the recursive algorithm is set as t₀, and asample standard deviation of d pieces of data previous to the initialtime by the formula (26), which is set as S_(t0); and a self-adaptivefunction of the time window length is used to determine the time windowlength p_(t) at the sample time t as follows:

$\begin{matrix}{p_{t} = \left\lbrack {\left( {1 - \frac{S_{t}}{S_{t0}}} \right) \cdot P_{\max}} \right\rbrack} & (28)\end{matrix}$

Wherein,

$\left\lbrack {\left( {1 - \frac{S_{t}}{S_{t0}}} \right) \cdot P_{\max}} \right\rbrack$

represents a maximum integer not more than a real number

${\left( {1 - \frac{S_{t}}{S_{t0}}} \right) \cdot P_{\max}}.$

According to the method for quick weighing of loose and small packagesof TCM in this embodiment, the actual weighing is carried out, whereinan AD sample frequency of an electronic weighing signal is 80 HZ, and anAD sample result is as shown in FIG. 1. Recursion is completed for thesampled data at sample points after the fifth sample points according tothe recursion process described above. FIG. 2 shows the identificationresult by using the traditional least square identification method, andFIG. 3 shows the identification result based on the identification modelof the vector prediction error. It can be seen from the comparison thatthe least square coefficient identification fluctuates greatly at thefirst 10 sample points, and the estimated value levels off when thecoefficient identification achieves the 20th sample points.

The identification method based on the identification model of thevector prediction error has been stable since the start of coefficientidentification without any large oscillation. When the recursionproceeds to the 10th sample point, the coefficient estimated value haslevelled off. By setting the actual mass of the medicine packages as M0,the weighing result obtained by the least square identification methodis M1, and the weighing result obtained by the identification model ofthe vector prediction error is M2. Ten groups of data are respectivelytaken for analysis and comparison, and the comparison results are shownas follows:

TABLE 1 Weighing Results Based on Traditional Least Square Method M030.65 30.65 30.65 30.65 30.65 30.65 30.65 30.65 30.65 30.65 M1 52.7533.93 31.81 31.40 31.48 31.37 31.44 31.41 31.32 31.46 Sample 5 10 15 2025 30 35 40 45 50 point time t Error 72.1% 10.7 3.8% 2.4% 2.7% 2.3% 2.5%2.4% 2.1% 2.6% rate

TABLE 2 Weighing Results through Identification Based on IdentificationModel of Vector Prediction Error M0 30.6 30.65 30.65 30.65 30.65 30.6530.65 30.65 30.65 30.65 M2 42.8 31.14 31.12 31.13 31.17 31.16 31.1731.16 31.15 31.17 Sample 5 10 15 20 25 30 35 40 45 50 time t Error 39.91.62 1.54% 1.57 1.68% 1.66% 1.69% 1.66% 1.64% 1.71% rate

It can be seen by comparison that the identification result based on theidentification model of vector prediction error is fast in weighingspeed, whereby the error rate is less than 2% at the 10th sample timeand the weighing result thereafter is relatively stable; while theweighing result levels off for convergence after the 20th sample time inthe traditional least square identification model which takes longer toweigh and results in a lower weighing efficiency than that of the methodprovided in the present disclosure. It can be seen from the weighingresult data that the steady-state error data of the weighing resultbased on the traditional least square identification method fluctuatesgreatly, while the steady-state error data of the method provided in thepresent disclosure fluctuates less.

After the 10th sample time, the maximum error rate of the weighingmethod provided in the present disclosure is only 1.71%, which means theactual error mass is less than 1 g for a medicine package of a massspecification of 30 g. Since the objective is to obtain an accuratequantity of medicine packages when weighing and counting TCM packageswithout critical demand of the total mass data of packages, so theweighing method of the present disclosure does not affect the accuratecounting of medicine packages, and the weighing accuracy of the methodprovided in the present disclosure fully satisfies the quick weighingrequirement of loose and small TCM packages. The weighing methodaccording to the present disclosure can make good use of the dynamicresponse characteristics of the system without having to wait for thesignal to level off, and make full use of dynamic information of thesystem without too much consideration about setting the time, whichmakes it particularly suitable for meeting the requirement of quick TCMprescription filling and dispensing in traditional TCM pharmacies.

In addition, in practical application, since the recursiveidentification method based on the identification model of vectorprediction error does not need to save all the sample values from thesample start time after acquiring new sample values every time, it hasthe advantages of a high calculation efficiency and a low memoryoverhead.

Finally, it is noted that the above embodiments are only for the purposeof illustrating the technical scheme of the present disclosure withoutlimiting it, and those of ordinary skills in the art should understandthat the modified scheme or equivalent alternative scheme substantiallythe same as the technical scheme of the present disclosure should alsobe included in the claim scope of the present disclosure.

What is claimed is:
 1. A method for quick weighing of loose and smallpackages of traditional Chinese medicine (TCM), comprising: 1)Establishing an equivalent physical model of a weighing system for looseand small packages: $\begin{matrix}{{{\left( {M + m} \right)\frac{d{y(t)}^{2}}{d^{2}t}} + {c\frac{d{y(t)}}{dt}} + {k{y(t)}}} = {{Mgu}(t)}} & (1)\end{matrix}$ Wherein, m is the equivalent mass of the medicinereceiving tank; M is the mass of medicine packages to be weighed; y(t)is the output signal of the weighing system; g is the gravitationalacceleration; c is the equivalent damping coefficient of the weighingsystem; k is the equivalent elastic coefficient of the weighing system;when loose and small packages of TCM fall on the medicine receivingtank, the medicine packages will vibrate synchronously with the weighingsystem represented by the medicine receiving tank, which may be regardedas applying a step signal Mgu(t) to the weighing system, wherein u(t)represents the step signal; after Laplace transformation, the outputsignal is obtained as follows: $\begin{matrix}{{{Y(s)} = {{Mg} \cdot \frac{1}{s} \cdot \frac{1}{{\left( {M + m} \right)s^{2}} + {cs} + k}}},} & (2)\end{matrix}$ wherein since the sampled signal is a discrete value, Ztransformation is performed for Y(s) so as to obtain: $\begin{matrix}{{{Y(z)} = {\frac{{b_{1}z^{- 1}} + {b_{2}z^{- 2}}}{1 + {a_{1}z^{- 1}} + {a_{2}z^{- 2}}} \cdot {U(z)}}},} & (3)\end{matrix}$ wherein a₁, a₂, b₁, and b₂ are coefficients related to M,m, c, and k; and taking into account a weighing error caused by noise atan input terminal, the formula (3) is expressed by a difference equationas:y(t)=−a ₁ y(t−1)−a ₂ y(t−2)+b ₁ u(t−1)+b ₂ u(t−2)+e(t)  (4), wherein, onview of the formula (3) and according to the final-value theorem of theZ transformation, a system output in a steady state is obtained asfollows: $\begin{matrix}{{{\lim\limits_{t\rightarrow\infty}{y(t)}} = {{\lim\limits_{z\rightarrow 1}{\left( {z - 1} \right) \cdot {Y(z)}}} = {\frac{b_{1} + b_{2}}{1 + a_{1} + a_{2}} = \frac{Mg}{k}}}},} & (5)\end{matrix}$ wherein, as a result, a calculation formula is obtainedfor the mass of medicine packages to be weighed M as follows:$\begin{matrix}{{M = {\frac{k}{g} \cdot \frac{b_{1} + b_{2}}{1 + a_{1} + a_{2}}}},} & (6)\end{matrix}$ wherein g is the gravitational acceleration, and k is theequivalent elastic coefficient of the weighing system; wherein: 2)Calculating a₁, a₂, b₁, and b₂ on the basis of a vector predictionerror, comprising: a) A scalar prediction error at the time t of asample sequence of the weighing system is defined as:e(t)=y(t)−[−â ₁ y(t−1)−â ₂ y(t−2)+{circumflex over (b)} ₁u(t−1)+{circumflex over (b)} ₂ u(t−2)]=y(t)−φ^(T) _(t){circumflex over(θ)}_(t−1)  (7), wherein, in the formula t>2:φ_(t)=[−y(t−1),−y(t−2),u(t−1),u(t−2)]^(T)  (8){circumflex over (θ)}_(t−1)=[â ₁ ,â ₂ ,{circumflex over (b)} ₁,{circumflex over (b)} ₂]^(T)  (9), wherein φ_(t) represents aninformation vector of the system at a time of the t^(th) sample point,{circumflex over (θ)}_(t−1) represents a coefficient identificationresult of the system at a time before the t^(th) sample point; y(t)represents a sample output sequence at the t^(th) sample point, y(t−1)represents a sample output sequence at a time before the t^(th) samplepoint, y(t−2) represents a sample output sequence at two times beforethe t^(th) sample point; u(t−1) is a sample output sequence at a timebefore the t^(th) sample point, u(t−2) is a sample output sequence attwo times before the t^(th) sample point; â₁ is an estimated value ofthe coefficient a₁, â₂ is an estimated value of the coefficient a₂,{circumflex over (b)}₁ is an estimated value of the coefficient b₁, and{circumflex over (b)}₂ is an estimated value of the coefficient b₂; b)By taking into consideration p_(t) sets of data in total from the timet−p_(t)+1 to the time t of the weighing system sample sequence, it isset that: $\begin{matrix}{Y_{t}^{p_{t}} = \begin{bmatrix}{y(t)} \\{y\left( {t - 1} \right)} \\M \\{y\left( {t - p_{t} + 1} \right)}\end{bmatrix}} & (10) \\{{\Phi_{t}^{p_{t}} = \left\lbrack {\varphi_{t},\varphi_{t - 1},L,\varphi_{t - p_{t} + 1}} \right\rbrack},} & (11)\end{matrix}$ wherein: p_(t) is a length of time window; Y_(t) ^(p) ^(t)represents an output vector formed by inverting a sample output sequencewithin a range p_(t) of the system previous to a time t; Φ_(t) ^(p) ^(t)represents an information matrix formed by inverting an informationvector within a range p_(t) previous to a time t; p_(t) is a variablethat varies along with any change of statistical properties of locallysampled data at the time t, resulting in the vector prediction errorwith an extended length of time window of p_(t) as follows:$\begin{matrix}{{E_{t}^{p_{t}} = {\begin{bmatrix}{e(t)} \\{e\left( {t - 1} \right)} \\M \\{e\left( {t - p_{t} + 1} \right)}\end{bmatrix} = \begin{bmatrix}{{y(t)} - {\varphi_{t}^{T}{\overset{\hat{}}{\theta}}_{t - 1}}} \\{{y\left( {t - 1} \right)} - {\varphi_{t - 1}^{T}{\overset{\hat{}}{\theta}}_{t - 2}}} \\M \\{{y\left( {t - p_{t} + 1} \right)} - {\varphi_{t - p_{t} + 1}^{T}{\overset{\hat{}}{\theta}}_{t - p_{t}}}}\end{bmatrix}}},} & (12)\end{matrix}$ wherein E_(t) ^(p) ^(t) represents a vector formed byinverting a scalar prediction error sequence within a range p_(t) of thesystem starting from a time t; and, given that theoretically {circumflexover (θ)}_(t−1) is closer to a real value θ than an estimated value of asystem coefficient at a previous time, {circumflex over (θ)}_(t−1) isused to replace the estimated value of the system coefficient at theprevious time, so that the above formula may be altered into:$\begin{matrix}{{E_{t}^{p_{t}} = {\begin{bmatrix}{{y(t)} - {\varphi_{t}^{T}{\overset{\hat{}}{\theta}}_{t - 1}}} \\{{y\left( {t - 1} \right)} - {\varphi_{t - 1}^{T}{\overset{\hat{}}{\theta}}_{t - 1}}} \\M \\{{y\left( {t - p_{t} + 1} \right)} - {\varphi_{t - p_{t} + 1}^{T}{\overset{\hat{}}{\theta}}_{t - 1}}}\end{bmatrix} = {Y_{t}^{p_{t}} - {{\Phi^{T}}_{t}^{p_{t}}{\overset{\hat{}}{\theta}}_{t - 1}}}}},} & (13)\end{matrix}$ wherein it can be known from the formula (13) that theweighing system is based on an identification model of a vectorprediction error:Y _(t) ^(p) ^(t) =Φ_(t) ^(Tp) ^(t) {circumflex over (θ)}_(t−1) +E _(t)^(p) ^(t)   (14), wherein the formula (14) is expressed as theidentification model of the vector prediction error: c) According to theidentification model of the vector prediction error, a criterionfunction is defines as below: $\begin{matrix}{{{J\left( {\overset{\hat{}}{\theta}}_{t - 1} \right)} = {{\sum\limits_{i = 1}^{t}{{Y_{i}^{p_{i}} - {{\Phi^{T}}_{i}^{p_{i}}{\hat{\theta}}_{i - 1}}}}^{2}} = {\sum\limits_{i = 1}^{t}{E_{i}^{p_{i}}}^{2}}}},} & (15)\end{matrix}$ wherein ∥E_(t) ^(p) ^(t) ∥ is a 2-norm of the vector E_(t)^(p) ^(t) , and J({circumflex over (θ)}_(t−1)) is a criterion function;d) {circumflex over (θ)}_(t−1) that may minimize the criterion functionis evaluated to obtain a coefficient estimated value based on theidentification model of the vector prediction error. $\begin{matrix}{Z_{t} = \begin{bmatrix}Y_{1}^{p_{1}} \\Y_{2}^{p_{2}} \\M \\Y_{t}^{p_{1}}\end{bmatrix}} & (16) \\{{H_{t} = \begin{bmatrix}{\Phi_{\;}^{T}}_{1}^{p_{1}} \\{\Phi_{\;}^{T}}_{2}^{p_{2}} \\M \\{\Phi_{\;}^{T}}_{t}^{p_{t}}\end{bmatrix}},} & (17)\end{matrix}$ wherein, so that the criterion function may be expressedas:J({circumflex over (θ)}_(t−1))=(Z _(t) −H _(t){circumflex over(θ)}_(t−1))^(T)(Z _(t) −H _(t){circumflex over (θ)}_(t−1))  (18),wherein a vector differential formula is used to derive J({circumflexover (θ)}_(t−1)) and set the result thereof as 0, so as to calculate{circumflex over (θ)}_(t−1) that may minimize the criterion function:$\begin{matrix}{{{\overset{\hat{}}{\theta}}_{t - 1} = {{\left( {H_{t}^{T}H_{t}} \right)^{- 1}H_{t}^{T}Z_{t}} = {\left\lbrack {\sum\limits_{i = 1}^{t}{\Phi_{i}^{p_{i}}{\Phi^{T}}_{i}^{p_{i}}}} \right\rbrack^{- 1}\left\lbrack {\sum\limits_{i = 1}^{t}{\Phi_{i}^{p_{i}}{Y^{T}}_{i}^{p_{i}}}}\  \right\rbrack}}},} & (19)\end{matrix}$ d) The recursive calculation form of {circumflex over(θ)}_(t−1) is derived, which sets that: $\begin{matrix}{{R_{t}^{- 1} = {\sum\limits_{i = 1}^{t}{\Phi_{i}^{p_{i}}{\Phi_{\;}^{T}}_{i}^{p_{i}}}}},} & (20)\end{matrix}$ wherein, so that:R _(t) ⁻¹ =R _(t−1) ⁻¹+Φ_(t) ^(p) ^(t) Φ_(t) ^(Tp) ^(t)   (21), whereinafter the simplification of the above formula by using the matrixinversion theorem, a recursive formula for identifying coefficientsbased on the identification model of vector prediction error is finallyobtained as follows: $\begin{matrix}{\quad\left\{ \begin{matrix}{{\overset{\hat{}}{\theta}}_{t + 1} = {{\overset{\hat{}}{\theta}}_{t} + {L_{t + 1}E_{t + 1}^{p_{t}}}}} & {\mspace{265mu}(22)} \\{L_{t + 1} = {R_{t}{\Phi_{t + 1}^{p_{t}}\left\lbrack {I_{p_{t}} + {{\Phi^{T}}_{t + 1}^{p_{t}}R_{t}\Phi_{t + 1}^{p_{t}}}} \right\rbrack}^{- 1}}} & {\mspace{265mu}(23)} \\{R_{t + 1} = {R_{t} - {L_{t + 1}{\Phi^{T}}_{t + 1}^{p_{t}}R_{t}}}} & {\mspace{76mu}{\quad\mspace{191mu}(24)}}\end{matrix} \right.} & \;\end{matrix}$ wherein L_(t+1) is an algorithm gain vector; thecoefficient estimation vector {circumflex over (θ)}_(t+1) at the timet+1 is the product of the gain vector L_(t+1) and the vector predictionerror E_(t+1) ^(p) ^(t) , which corrects the coefficient estimationvector {circumflex over (θ)}_(t) at the time t; wherein here is therecursion process: (1) Initialization: a start time is set as t₀=5,which indicates the recursion process starts from the fifth samplingpoint of the sampling sequence, {circumflex over (θ)}₅=[0,0,0,0]^(T);R₅=α·I₄, wherein α is a sufficiently large positive integer, I₄represents an identity matrix of 4×4; and at the same time, a number oftimes, N, of recursive iteration is determined; (2) By analyzing thestatistical characteristics of locally sampled data, the length of timewindow p_(t) is determined; at the same time, the sample output sequenceand the input sequence of the weighing system are obtained to constructan output vector Y_(t+1) ^(p) ^(t) according to the formula (10), and toconstruct an information matrix Φ_(t+1) ^(p) ^(t) according to theformulas (8) (11); and then a vector prediction error E_(t+1) ^(p) ^(t)is obtained by using the formula (13); (3) L_(t+1) and R_(t+1) arecalculated according to the formula (23) and formula (24) in therecursion formula, and then {circumflex over (θ)}_(t+1) is calculatedaccording to the formula (22); (4) It is determined whether t=t+1 hasreached a specified number of iteration times N. If not, proceed to thestep (2), or otherwise end the recursion process; and 3) According toa₁, a₂, b₁, and b₂ obtained in the step 2) and the formula (6),obtaining the weight of the loose and small packages of TCM that areweighed.
 2. The method for quick weighing of loose and small packages ofTCM according to claim 1, wherein: the length of time window p_(t) isdetermined as below: A length interval of the time window of the t^(th)sample time is defined as follows:p _(t)∈[P _(min) ,P _(max)]  (25), wherein P_(min) represents the lowerlimit value of the length interval, and P_(max) represents the upperlimit value of the length interval, i.e., the length of the time windowp_(t) can slide from P_(min) to P_(max) according to statisticalcharacteristics of the sampled data; A standard deviation of a sequenceformed by d system sample output values previous to a time t is definedas follows: $\begin{matrix}{{S_{t} = \sqrt{\frac{\sum\limits_{i = {t - d + 1}}^{t}\left( {y_{i} - \overset{\_}{y}} \right)^{2}}{d}}},} & (26)\end{matrix}$ wherein, it can be seen from tests for d that thestability and smoothness of local data can be better reflected when d=5;y_(i) represents a system sample output value at the i^(th) sample time,and y represents an average sample value of a sequence formed by dsystem sample output values previous to the time t, which is calculatedby the following formula: $\begin{matrix}{{\overset{\_}{y} = {\frac{1}{d} \cdot {\sum\limits_{\;^{i = {t - d + 1}}}^{t}y_{i}}}},} & (27)\end{matrix}$ an initial recursive time of the recursive algorithm isset as t₀, and a sample standard deviation of d pieces of data previousto the initial time by the formula (26), which is set as S_(t0); and aself-adaptive function of the time window length is used to determinethe time window length p_(t) at the sample time t as follows:$\begin{matrix}{{p_{t} = \left\lbrack {\left( {1 - \frac{S_{t}}{S_{t0}}} \right) \cdot P_{\max}} \right\rbrack},} & (28)\end{matrix}$ wherein,$\left\lbrack {\left( {1 - \frac{S_{t}}{S_{t0}}} \right) \cdot P_{\max}} \right\rbrack$ represents a maximum integer not more than a real number${\left( {1 - \frac{S_{t}}{S_{t0}}} \right) \cdot P_{\max}}.$
 3. Themethod for quick weighing of loose and small packages of TCM accordingto claim 1, wherein: in the recursion process, α=10 a number ofiteration times N is 8-10.